package edu.sctu.practice.class01.nieyu.assign03.assign03_2;

/**
 * Created by Administrator on 2015/10/22.
 */
public class Cylinder extends Circle{

    private double length;

    public Cylinder()
    {
        super();
        length = 1.0;
    }

    public Cylinder( double length)
    {

        this.length = length;
    }


    public double getLength()
    {

        return length;
    }

    public void setLength(double length)
    {

        this.length = length;
    }

    public double findArea()
    {

        return super.findArea()*2+(2*getRadius()*Math.PI)*length;
    }
    public double findVolume()
    {

        return super.findArea()*length;
    }
    public boolean equals(Cylinder cylinder)
    {

        return (this.radius == cylinder.getRadius()) &&
                (this.length == cylinder.getLength());
    }

    public String toString()
    {

        return "圆柱半径为： " + radius + " 高为： "+ length;
    }

}
